var imgs1 = document.querySelectorAll(".imgs a")
var spans1 = document.querySelectorAll(".spans span")

imgs1[0].style.opacity = '1'
spans1[0].style.backgroundColor = 'orange' 
//自动轮播
var index1 = 0
setInterval(() => {
	if(index1 < 8){
		index1++
	}else{
		index1 = 0
	}
	for(var i=0; i<imgs1.length; i++){
		imgs1[i].style.opacity = '0'
		spans1[i].style.backgroundColor = '#e5cdaa' 
	}
	imgs1[index1].style.opacity = '1'
	spans1[index1].style.backgroundColor = 'orange' 
},2500)

//点击圆点
for(let i =0; i<spans1.length; i++){
	spans1[i].onclick = function(){
		for(var j=0; j<imgs1.length; j++){
			imgs1[j].style.opacity = '0'
			spans1[j].style.backgroundColor = '#e5cdaa' 
		}
		spans1[i].style.backgroundColor = 'orange' 
		imgs1[i].style.opacity = '1'
		index1 = i
	}
}

var pics = document.querySelectorAll(".news")
var uls = document.querySelectorAll(".body ul")

pics[0].classList.add('pic00')
uls[0].style.display = 'block'
//新闻栏点击事件
for(let i = 0; i<spans1.length; i++){
	pics[i].onclick = function(){
		for(var j=0; j<pics.length; j++){
			uls[j].style.display = 'none'
			pics[j].classList.remove('pic0' + j)
		}
		uls[i].style.display = 'block'
		pics[i].classList.add('pic0' + i)
	}
}


